package Reflect;

import java.io.FileOutputStream;
import java.io.PrintStream;
import java.lang.reflect.Field;

public class MybatisUtil {
    public static  void save(Object obj){
            try ( PrintStream printStream = new PrintStream(new FileOutputStream("test1.txt",true));)
            {

                Class c=obj.getClass();
                printStream.println("============="+c.getSimpleName()+"================");
                Field[] fields = c.getDeclaredFields();
                for (Field field : fields) {
                    String name = field.getName();
                    field.setAccessible(true);
                    String value = field.get(obj) + "";
                    printStream.println(name +"="+ value);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

}

